package guava.event;

import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.SubscriberExceptionContext;
import com.google.common.eventbus.SubscriberExceptionHandler;

/**
 * Created by lxue on 16/5/7.
 */
public class Main {
    public static void main(String[] args) {
        EventBus eventBus = new EventBus(new SubscriberExceptionHandler() {
            @Override
            public void handleException(Throwable throwable, SubscriberExceptionContext subscriberExceptionContext) {
                System.out.println(subscriberExceptionContext.getEvent());
            }
        });
        Subscriber subscriber = new Subscriber();
        eventBus.register(subscriber);
        eventBus.post(new CustomerChangeEvent("自定义事件"));
    }
}
